package com.aiyige.page.player;

import com.chad.library.adapter.base.entity.MultiItemEntity;

/**
 * Created by xiachao on 2017/11/14.
 */

public class PlaySpeed implements MultiItemEntity {

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    private String name;

    private int value = SPEED_PERCENT_100;

    /**
     * 设置倍数播放
     * @param speed 倍数值，16 进制表示，高 4 位代表分子，低 4 位代表分母
     * 例如：0X00010002 表示 0.5 倍数，0X00040001 表示 4 倍数
     * 范围：0.1～32 倍数
     */

    public static final int SPEED_PERCENT_20 = 0X00010005;

    public static final int SPEED_PERCENT_40 = 0X00020005;

    public static final int SPEED_PERCENT_60 = 0X00030005;

    public static final int SPEED_PERCENT_80 = 0X00040005;

    public static final int SPEED_PERCENT_100 = 0X00010001;

    public static final int SPEED_PERCENT_150 = 0X00030002;

    public static final int SPEED_PERCENT_200 = 0X00020001;

    private PlaySpeed(Builder builder) {
        name = builder.name;
        value = builder.value;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    @Override
    public int getItemType() {
        return 0;
    }

    public static final class Builder {
        private String name;
        private int value;

        private Builder() {
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder value(int value) {
            this.value = value;
            return this;
        }

        public PlaySpeed build() {
            return new PlaySpeed(this);
        }
    }
}
